<?



class DataVerifier_JCATBuildin_LengthDoc extends DataVerifierDoc 
{
	
	/**
	 * what's this
	 * 
	 * @access	public
	 * @param	$sName=''	string	What's this Parameter ?
	 * @return	array
	 */
	public function DataVerifier_JCATBuildin_LengthDoc()
	{
		$this->DataVerifierDoc() ;
	}
	


	/**
	 * what's this
	 * 
	 * @access	public
	 * @return	string
	 * @static 
	 */
	static public function GetControllerName()
	{ return 'DataVerifier_JCATBuildin_Length' ; }

	
	/**
	 * what's this
	 * 
	 * @access	public
	 * @static 
	 * @return	string
	 */
	static public function GetDVClassName()
	{
		return 'JCAT_UICtrlLengthVerifier' ;
	}
	
	/**
	 * what's this
	 * 
	 * @access	public
	 * @return	string
	 */
	public function GetRuleIntro()
	{
		$sRuleIntro = '' ;
		
		if( !$this->Get('IgnoreMin') )
			$sRuleIntro.= JCAT_Language::Sentence('最小值:%d; ',$this->Get('Min')) ;
		if( !$this->Get('IgnoreMax') )
			$sRuleIntro.= JCAT_Language::Sentence('最大值:%d; ',$this->Get('Max')) ;
		
		$sRuleIntro.= $this->Get('AllowEmpty')?
							JCAT_Language::Sentence('允许为空') :
							JCAT_Language::Sentence('不允许为空') ;
		return $sRuleIntro ;
	}
	

	/**
	 * what's this
	 * 
	 * @access	public
	 * @param 	$sUICtrlVarName		string
	 * @return	string
	 */
	public function CreateCode( $sUICtrlVarName, $nTab=0 )
	{
		JCAT_ASSERT::ASSERT_STRING($sUICtrlVarName) ;
		
		if( !$this->IsEnable() )
			return '' ;
			
		$sMin = $this->Get('IgnoreMin')? '-1': $this->Get('Min')  ; 
		$sMax = $this->Get('IgnoreMax')? '-1': $this->Get('Max')  ; 
		$sAllowEmpty = $this->Get('AllowEmpty')? 'true': 'false' ;
		if(!$sMin)
			$sMin = '-1' ;
		if(!$sMax)
			$sMax = '-1' ;
		
		$sTab = str_repeat('	',$nTab) ;
		
		$sRet = "{$sTab}// ".$this->GetRuleIntro()."\r\n" ;
		$sRet.= "{$sTab}{$sUICtrlVarName}->AddVerifier(JCAT_Flyweight::GetGlobalInstance('JCAT_UICtrlLengthVerifier',{$sMin},{$sMax},{$sAllowEmpty})) ;" ;
		return $sRet ;
	}
	
	/**
	 * what's this
	 * 
	 * @access	public
	 * @static 
	 * @return	string
	 */
	static public function CreateCode_ImportClass()
	{
		return "JCAT_Package::ImportClass('JCAT_UICtrlLengthVerifier',JCAT::PACKAGE_MVCDV) ;" ;
	}
}
?>